home *** CD-ROM | disk | FTP | other *** search
- OVRACT
-
- OVRACT is a unit that captures data about the activities of the overlay
- manager in a Turbo Pascal 5.x program and saves it in a disk file.
- To use it, add the unit OVRACT as near as possible to the beginning of the uses
- statement of your main program. Actually, you can insert it anywhere, but
- overlay activity caused by initialization and exit procedures for any units
- appearing before OVRACT in the uses statement will not be reported.
-
- Compile and run the program normally. If you are running DOS 3.0 or later, a
- file named ProgName.OVD will be produced, where ProgName is the root name of
- your EXE file. Under earlier versions of DOS, a file named OVRACT.OVD is
- produced. This must be renamed ProgName.OVD before running one of the
- report programs.
-
- For a quick demo, grab the example overlay program that came with your copy
- of Turbo Pascal, consisting of the files OVRDEMO.PAS, OVRDEMO1.PAS, and
- OVRDEMO2.PAS. (They're archived in DEMOS.ARC.) Add OVRACT to the
- Uses statement in OVRDEMO and compile to get an EXE file and a MAP file. Run
- OVRDEMO and stop it by pressing any key. You should now have a file named
- OVRDEMO.OVD. To see a report, type OVRACTM /S /D OVRDEMO.
-
-
- OVRACTR and OVRACTM
-
- These two programs that produce reports from this data file are also
- included. They are documented in their source files. They are provided
- primarily as examples of how to read the data file and demonstrations of the
- kind of information that can be extracted from it. Hopefully other
- programmers will use this data file format to produce more useful utilities.
-
-
- File format
-
- The format of the overlay activity file was designed to provide as much
- information as possible using a minimum of disk space. Some modifications to
- the format to further reduce disk space usage were considered, but at a cost
- of complicating the format, which was not considered worth the disk space it
- might save.
-
- The file is defined as a file of words. However, it could be read as an
- untyped file for fast buffering if desired. The file starts with a word
- containing the file format version number. Programs using this file format
- should check this value in case the format should change in a later version
- of this software. The next word contains the value of the PrefixSeg of the
- main program. This is followed by the "code list," a list of data for all
- overlaid units in the program. For information on specific fields refer to
- the pseudo-code below. The list is terminated by a zero word.
-
- The rest of the file consists of events. The two types of events are load
- and reprieve. A load event occurs when a call is made to a unit that is not
- present in the overlay buffer. A reprieve event occurs when a call is made
- to a unit that is on probation. The data for either type of event begins
- with the event time, expressed as the number of system clocks ticks since the
- start of the program. This is optionally followed by an Overlay Buffer
- Change record, which always exists in the first event, and also appears in
- any subsequent event when the value of either OvrHeapOrg or OvrHeapEnd has
- changed since the previous event. The next two words give the static segment
- address of the unit being loaded or reprieved in this event, and the offset
- within that segment of the procedure call that caused this event. In a load
- event this is followed by a the "load list," which is composed of a pair of
- words for each unit in the overlay buffer. The first word of each pair is
- the static segment of the unit, and the second word is the segment address
- where the unit is loaded in the overlay buffer. In a reprieve event, there
- is no load list since it would be exactly the same as the previous event. In
- either case, the event is terminated by a zero word.
-
-
- Pseudo-code for file format
-
- FileFormatVersion : Word;
- PrefixSeg : Word;
-
- Code list
- for each overlaid unit in program
- StatSeg : Word; { static dispatcher segment relative to Prefix+$10 }
- FileOfs : LongInt; { offset of overlay code in OVR file }
- CodeSize : Word; { size of code in overlay file }
- FixupSize : Word; { size of transient fixup data }
- EntryPts : Word; { number of functions and procedures in unit }
- endfor
- EndListMark : Word = 0;
-
- repeat Event
- Time : LongInt { System clock ticks since start of program }
-
- Overlay buffer change { present only in first event or when limits change }
- OvrHeapMark : Word = $FFFF;
- OvrHeapOrg : Word;
- OvrHeapEnd : Word;
-
- OvrSeg : Word; { Static segment of unit being loaded or reprieved }
- OvrOfs : Word; { Offset of procedure call that caused this event }
-
- Load list { not present in reprieve event }
- for each unit loaded in the overlay buffer
- StaticSegment : Word; { static segment of the unit }
- LoadSegment : Word; { segment where the unit is loaded in buffer }
- endfor
-
- EndListMark : Word = 0;
- until end of file
-
- For further information, please see the file OVRLAY.TXT (CompuServe BPROGA
- forum LIB 2).
-
- Thanks to the CompuServe BPROGA gang for inspiration, assistance and
- encouragement.
-
- Ron Schuster [76666,2322]